package api.model;

import m.common.model.FieldMeta;
import m.common.model.LinkTableMeta;
import m.common.model.Model;
import m.common.model.TableMeta;
import m.common.model.type.FieldType;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;
import m.system.cache.FlushCacheList;

import java.util.List;

@TableMeta(name="ot_api_convert_data_column",description="转换数据列表")
public class ApiConvertDataColumn extends Model implements FlushCacheList {
    @LinkTableMeta(name="api_convert_data_oid",table= ApiConvertData.class,description="所属转换数据表")
    private ApiConvertData apiConvertData;
    @FieldMeta(name="source_column",type= FieldType.STRING,length=50,notnull = true,description="源数据表列")
    private String sourceColumn;
    @FieldMeta(name="save_column",type= FieldType.STRING,length=50,notnull = true,description="保存表列")
    private String saveColumn;

    public ApiConvertData getApiConvertData() {
        return apiConvertData;
    }

    public void setApiConvertData(ApiConvertData apiConvertData) {
        this.apiConvertData = apiConvertData;
    }

    public String getSourceColumn() {
        return sourceColumn;
    }

    public void setSourceColumn(String sourceColumn) {
        this.sourceColumn = sourceColumn;
    }

    public String getSaveColumn() {
        return saveColumn;
    }

    public void setSaveColumn(String saveColumn) {
        this.saveColumn = saveColumn;
    }

    @Override
    public List<ApiConvertDataColumn> getCacheList(String key) throws Exception {
        return ModelQueryList.getModelList(ApiConvertDataColumn.class,new String[]{"*"},null, QueryCondition.eq("apiConvertData.oid",key));
    }
}
